package client

import (
	"yunj/app/enum/redisenum"
	"yunj/app/model"
	"yunj/pkg/global"
	"yunj/pkg/yunj/util"
)

type link struct {
	Service
}

var Link *link

// 获取正常已发布的连接
func (l *link) ItemsByNormalPublish() (links []*model.Link) {
	res, err := redisenum.KeyByValue(redisenum.KEY_INDEX_LINK_ITEMS).GetCache(0)
	if err != nil {
		global.Logger.Error("获取正常已发布的连接缓存异常！", err)
		return
	}

	links, err = util.JsonTo[[]*model.Link](res)
	if err != nil {
		global.Logger.Error("获取正常已发布的连接缓存错误！", err)
	}
	return
}
